<template>
  <div>
    <button @click="getval">登录</button>
  </div>
</template>

<script lang="ts">
export default {
  name: 'VTest'
}
</script>
<script setup lang="ts">
import { ref } from 'vue'
import { reqLogin } from '@/api/user'
// 登录
// export interface IReqLoginRes {
//   code: number
//   data: IReqLoginData
//   message: string
//   success: boolean
// }

// export interface IReqLoginData {
//   token: string
// }
// 用户信息
// export interface IReqUserInfo {
//   code: number
//   data: IReqUserInfoData
//   message: string
//   success: boolean
// }

// export interface IReqUserInfoData {
//   avatar: string
//   buttons: string[]
//   name: string
//   roles: string[]
//   routes: string[]
// }

const state = ref({
  username: 'admin',
  password: '111111'
})
const getval = async () => {
  const res = await reqLogin(state.value.username, state.value.password)
  console.log(res.data.token)
}
</script>
<style scoped></style>
